<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=gbk">
		<link href="css/style.css" rel="stylesheet" type="text/css">
		<title>维护入库单的明细</title>
		<script type="text/javascript">
			var link;
			function buyInDetailMod( link ) {
				var d = document.forms[0];
				d.action = link;
				d.submit();
			}

			function buyInDetailDel( link ) {
				if (window.confirm("确认删除吗？")) {
					var d = document.forms[0];
					d.action = link;
					d.submit();
				} else {

				}
			}
		</script>
	</head>

	<body>
		<center>
			<h2>
				维护入库单的明细
			</h2>
		</center>
		<div align="center">

		入库单号：<s:property value="%{buyInMain.id}" /> <br/>
		供应商：  <s:property value="%{buyInMain.suppName}" /> <br/>
		入库日期：  <s:property value="%{buyInMain.buyDate}" /> <br/>

			<form action="#" method="post">
				<table border="1" width="80%">
					<tr>
						<th>明细号</th>
						<th>商品</th>
						<th>单价</th><th>数量</th><th>金额</th>
						<th>维护</th>
					</tr>
					<s:iterator value="#request.buyInDetailList" id="buyInDetail">
						<tr>
							<td>
								<s:property value="#buyInDetail.id" />
							</td>
							<td>
								<s:property value="#buyInDetail.goodName" />
							</td>
							<td>
								<s:property value="#buyInDetail.price" />
							</td>
							<td>
								<s:property value="#buyInDetail.amount" />
							</td>
							<td>
								<s:property value="#buyInDetail.money" />
							</td>
							<td>
								<input type="button" value="修改" name="update" onclick="buyInDetailMod('prepareModBuyInDetail?buyInDetailId=<s:property value="#buyInDetail.id" />')" />
								<input type="button" value="删除" name="delete" onclick="buyInDetailDel('deleteBuyInDetail?buyInDetailId=<s:property value="#buyInDetail.id" />&buyInMainId=<s:property value="#buyInDetail.buyInId" />')" />
								<!-- “删除” 传第2个参数，是为了成功后，给 跳转的 Action传递参数 -->
							</td>
						</tr>
					</s:iterator>
				</table>
			</form>

			<br/>
			<a href="prepareAddBuyInDetail?buyInMainId=<s:property value="%{buyInMain.id}" />" >新增</a>  &nbsp;
			<a onclick="javascript:history.go(-1);" href="#">返回</a>

		</div>
	</body>
</html>